/**
 * Copyright (c) 2006-2007 Jinyi.lu
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of GNU LGPL license by gun.org
 * which accompanies this distribution, and is available at
 * http://gnu.feld-it.at/copyleft/lesser.html
 * 
 * Project Homepage : http://code.google.com/p/demou
 * Source Code: svn checkout http://demou.googlecode.com/svn/trunk/ demou
 * Mailing list : jinyi.lu@gmail.com
 *                stonelu@126.com
 *
 *  
 * Contributors:
 *     JinYi.Lu - initial API and implementation
 */
package cn.tworen.demou.so;


/**
 * Created on  2007-2-13
 *
 * Title       : SoType.java
 * Description : 
 * 
 * @author     : LuJinYi
 * @version    : 1.0
 * @Date       : 2007-2-13
 * History     : 
 * 
 */
public enum SoType {
	CONNECT((byte)0x01),
	DISCONNECT((byte)0x02),
	ATTRIBUTE((byte)0x03),
	UPDATE_DATA((byte)0x04),
	ITEM_UPDATE_ATTRIBUTE((byte)0x05),
	MESSAGE((byte)0x06),
	STATUS((byte)0x07),
	ITEM_CLEAR_DATA((byte)0x08),
	DELETE_DATA((byte)0x09),
	DELETE_ATTRIBUTE((byte)0x0A),
	ITEM_INIT_DATA((byte)0x0B);
	public byte value;
	private SoType(byte value){
		this.value = value;
	}
	public static SoType getSoType(byte value) {
		switch(value) {
		case 0x01:
			return CONNECT;
		case 0x02:
			return DISCONNECT;
		case 0x03:
			return ATTRIBUTE;
		case 0x04:
			return UPDATE_DATA;
		case 0x05:
			return ITEM_UPDATE_ATTRIBUTE;
		case 0x06:
			return MESSAGE;
		case 0x07:
			return STATUS;
		case 0x08:
			return ITEM_CLEAR_DATA;
		case 0x09:
			return DELETE_DATA;
		case 0x0A:
			return DELETE_ATTRIBUTE;
		case 0x0B:
			return ITEM_INIT_DATA;
		default:
			return null;
		}
	}
}
